﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections;
using System.Data;
using System.Data.SqlClient;

namespace B2B.Models
{
    public class LinhVuc
    {
        private int maLinhVuc;

        public int MaLinhVuc
        {
            get { return maLinhVuc; }
            set { maLinhVuc = value; }
        }
        private string tenLinhVuc;

        public string TenLinhVuc
        {
            get { return tenLinhVuc; }
            set { tenLinhVuc = value; }
        }

        public ArrayList DanhSachLinhVuc()
        {
            ArrayList list_LinhVuc = new ArrayList();
            SqlConnection conn = KetNoi.Connection();
            SqlCommand cmd = new SqlCommand("SP_DANHSACHLINHVUC", conn);
            
            cmd.CommandType = CommandType.StoredProcedure;
            conn.Open();
            SqlDataReader reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                LinhVuc lv = new LinhVuc();
                lv.maLinhVuc = reader.GetInt32(0);
                lv.TenLinhVuc = reader.GetString(1);
                list_LinhVuc.Add(lv);
            }
            conn.Close();
            return list_LinhVuc;
        }
    }
}